<?php
function logger($msg,$type){
	$logfile = "logs/basis.log";
	$datum = date("d-m-Y|H:i:s");
	$ip = $_SERVER['REMOTE_ADDR'];
	$folr = fopen($logfile, 'r')or die('FOUT::logbestand niet gevonden!');
	$inhoudlogfile = "";
	while (!feof($folr)) {
	$inhoudlogfile .= fread($folr, 8192);
	}
	fclose($folr);
	if ($type == "R"){
		$ftype = "<R:!";
		$btype = "!:R>";
	}
	else if ($type == "O"){
		$ftype = "<O:!";
		$btype = "!:O>";
	}
	else if ($type == "G"){
		$ftype = "<G:!";
		$btype = "!:G>";
	}
$line = $ftype ."[" . $datum . "#" . $ip . "#" . $msg . "]" . $btype . "\n";
$vollediglog = $line . $inhoudlogfile;
$fol  = fopen($logfile, 'w')or die('FOUT::logbestand niet gevonden!');
fwrite($fol, $vollediglog);
fclose($fol);
}
